﻿using System;
using YArchitech.Revit.Electric.Common;

namespace ElectricDim
{
	public class ElectricMarkFilterEx : IFilterFamilyObject
	{
		public ElectricMarkFilterEx(int category, int subCategory)
		{
			this.categoryValue = category;
			this.subCategoryValue = subCategory;
		}

		bool IFilterFamilyObject.IsMatch(DbFamilyObject familyObject)
		{
			if (familyObject == null)
			{
				return false;
			}
			bool flag = false;
			foreach (DbFamilyParameter dbFamilyParameter in familyObject.Parameters)
			{
				if (dbFamilyParameter.Value != null && "Category" == dbFamilyParameter.Name && this.categoryValue == Convert.ToInt32(dbFamilyParameter.Value))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				return false;
			}
			foreach (DbFamilyParameter dbFamilyParameter2 in familyObject.Parameters)
			{
				if (dbFamilyParameter2.Value != null && "SubCategory" == dbFamilyParameter2.Name && this.subCategoryValue == Convert.ToInt32(dbFamilyParameter2.Value))
				{
					return true;
				}
			}
			return false;
		}

		private const string categoryName = "Category";

		private const string subCategoryName = "SubCategory";

		private int categoryValue;

		private int subCategoryValue;
	}
}
